    {ERR}.com
    copyright 1993 XtraSoft Software.
    
    {ERR}.com is a small Terminate and Stay Resident (TSR) program that
    reports errorlevels returned by other programs.
    
    What it does ?
       Before {ERR}.com, in order to retrieve ERRORLEVELs, you would
       successively test for them in a batch file ( or by typing them
       in by hand ) using rather complicated and intimidating statements
       such as   IF ERRORLEVEL xxx ...
       and       IF ERRORLEVEL xxx IF NOT ERRORLEVEL xxx ...
       
       Nothing really precise to most people, and really hard to figure
       out later as to what the batch file did and how it functions.
       
       Alternative method 1.  Use a program such as ERR.exe ( also from
       XtraSoft Software ) to launch the code and have it SET environment
       variables in the command processors (COMMAND.COM ) environment.
             1. create temporary batch files and execute them 
          or 2. automatically update the environment thru software
          
       Alt.Method 1 required you to launch ERR with your program as an
       argument(s). But testing of errorlevels was NOT necessary for 
       launching. Just use a GOTO %ERR%  with appropriate labels set
       where you wanted it to go for that specific ERRORLEVEL
       
       I know this sounds complicated, but may be its easier to explain
       if its laid out in a pseudo-program layout.
       
           rem first execute the ERR with your program as ERR's arguments.
           ERR yourprogram with any parameters/arguments
           rem instead of using arguments just use a GOTO or 
           rem a IF (%ERR%)==(xxx) command
           rem example of a goto
           rem pretend your program was a program that reads a key
           rem and returns an errorlevel
           rem it returns a 0 for no key, 1 for a N, and 2 for a Y
           rem use
           GOTO %ERR%Key
           .
           .
           .
           rem use labels to indicate where it goes
           :0Key
           .... it comes here if its a zero
           .
           .
           .
           
           :1Key
           .... it comes here if its a 2
           .
           .
           
           :2key
           .... it comes here if its a 3

           rem  the GOTO %ERR%... works because when the batch file
           is processed, the %ERR% is substituted with whatever ERR
           is equal to in the environment. In other words, say that
           a 1 is returned as the ERRORLEVEL, ERR.exe sets ERR=1 in 
           the environment. When command.com reads the line
           GOTO %ERR%Key 
           it substitutes the %ERR% with a 1 and process the line as
           GOTO 1Key      which it then promptly does.

           .
           rem Testing with the IF statement
           rem use something like
           IF (%ERR%) == (xx) command
           you can even use something like
           IF !%ERR%! == !xx! command
           or
           IF .%ERR%. == .xx. command

           sample lines
           IF !%ERR%! == !0! ..command for 0
           IF !%ERR%! == !1! ..command for 1
           IF !%ERR%! == !2! ..command for 2

           rem again with substitution, it works like this
           the %ERR% is substituted with whatever value it holds in
           the environment. Let's say it is again a 1.
           The above lines become 

           IF !1! == !0! ..command for 0   ; not true so it doesn't do command
           IF !1! == !1! ..command for 1   ; true.. so it does command
           IF !1! == !2! ..command for 2   ; not true so it doesn't do command
          
           That's basicall all there is to using environment variables,
           but there is one additional feature. You can visually see what
           ERR equals by typing  SET followed by the Enter key. Just look
           for ERR= with its value.
***************************************************************************
 v2.0 note: {ERR}.com v2.0 has 2 versions out. 
            {ERR}B    works exactly as described above and below
            {ERR}A    works like {ERR}B but also has the abilities to
                      intercept System Exit codes.
                      EXIT=0    normal termination
                      EXIT=1    Ctrl-C termination
                      EXIT=2    termination by critical error
                                ( when you receive messages such as
                                i.e. Abort,Ignore,Fail?            )
                      EXIT=3    program went Terminate and Resident
                                by dos function 21h sub 31h
            The default {ERR}.com is a copy of {ERR}A.com    
            First load {ERR}.com. Type SET   and press Enter.
            You should find the lines 
               ERR=255
               EXIT=3
            This indicates that {ERR}.com (version {ERR}A ) should
            work for you.( It intercepts its own Error and Exit codes.)
            Then run any dos program ( not internal command. ). 
            Type SET and look for a string that says
                ERR=      & another that says EXIT=
            If you see both EXIT= and ERR= , you can use {ERR}A.
            If your system beeps either 3 or 6 times, your environment
            is too SMALL. Consult your dos manual and enlarge it.
            If you see neither EXIT= or ERR= , then you MUST use
            {ERR}B.com. 
                  1. use  COPY {ERR}B.COM {ERR}.COM /B
                  2. Reboot your system
                  3. Retry 

Add'l notes: 
1.{ERR}A.com and {ERR}B.com should work on any version of DOS higher than 
3.0. It has been tested on versions 3.3 and 5.0. If and when I purchase 6.0, 
I'll try it and update this file. If you try these programs on any other 
version other than 3.3 or 5.0, please let me know the results so that those 
results can be posted.

***************************************************************************
           
           {ERR}.com, the TSR version of ERR.exe.
           {ERR} sets the ERR=value like ERR.exe, but loads itself as
           a TSR. The difference is that, whenever an ERRORLEVEL is set
           by any program loaded after it, its value is SET automatically.
           Its significantly smaller ( its written in assembly language ).
           Its faster, too.

           OK, here's the specs.

                                                          {ERR}.com
             ERR.exe               {ERR}B.com             {ERR}A.com
                                                                      
filesize       9424                  2147                   2330 bytes

loaded size   28240                   992                   1056 bytes

method        invoked/            loaded once as a      same as {ERR}B
              called                   TSR

other..     must be called          automatically        also returns   
            and loaded each         changes ERR          system exit
            time                    according to         codes.
                                    ERRORLEVEL changes.


       To use {ERR}.com simply  type {ERR} and press Enter, or
       add a line in your autoexec.bat file to load it.
       {ERR} can be loaded high with the LH command.
       DO NOT ATTEMPT TO USE THE INSTALL= method in config.sys.
       Your system will probably lock up.
       
       Once loaded successfully, your screen should indicate

   {ERR}.com v2.0 TSR successfully installed              :
   Copyright XTRASoft Software 1993                       :  {ERR}A
   Special Edition (* Errorlevel & Exit Codes *)          :
   Author Wayne Robbins.                                  :

                   or

   {ERR}.com v2.0 TSR successfully installed              :
   Copyright XTRASoft Software 1993                       :  {ERR}B
   Author Wayne Robbins.                                  :
 
       
       IF you see this instead ( no v2.0 ),

   {ERR}.com TSR successfully installed                        
   Copyright XTRASoft Software 1993                                       
   Author Wayne Robbins.                                                      
   
       You have a potentially dangerous TSR loaded. It is perfectly
       OK to use if loaded from the DOS Prompt or the Autoexec.bat
       prior to loading any shell or other command interpreter. 
       Loading v1.0 after loading an add'l command.com would be fine
       until after you EXITed that add'l command.com. A system crash
       would probably be emminent. So Use v2.0. It takes care of this.
       ( but it cost about 300 bytes of memory ! )
       ( v1.0 was never officially released. Its distribution was 
         rather limited. )
       IF you try to load it again after it has already been loaded,
       {ERR} will reply with a ...
   
   {ERR} already installed...Aborting Installation 
       
       If you see the following message, there is a problem. Reboot
       your computer, As Soon As Possible !
    
   File Corrupted 
                            
        or

   Memory Allocation Error xxxx... aborted 
        
        This message will appear if you try to use {ERR} with DOS 
        versions less than 3.0.
   
   Installation Error . {ERR}.com v2.0 Requires Dos v3.0 or above 
       
       Command-line arguments and error messages.
       
       {ERR}  by itself will attempt to load {ERR}. It may produce any
       of the above error messages.
       
       {ERR} /R  will attempt to remove itself from memory. The following
       messages may appear.
          1. {ERR} has been removed.
          2. {ERR} is not loaded.
          3. Another program has been loaded after {ERR}.
             Please remove the other program first!

       {ERR} /?   will bring up {ERR}'s options.

       After you load {ERR}, there is no need to have ERR.exe preload
       your programs. And there is certainly NO need for IF ERRORLEVEL ...




       Distribution rights.
       All rights to this program are reserved. You are entitled to use this 
       program on any personal computer for personal use ONLY. Registration
       for personal use is OPTIONAL but WELCOMED. 
       Registration for use in a business or commercial environment is
       MANDATORY. Currently, Registration is $10 per computer.
       Registration for personal use.. Name, address, comments etc.
       Any and all comments welcomed, as well as donations. 
       (The donations help the author buy additional equipment,
       tools, and further his education. )
       
       Thanks for trying XtraSoft Software.

       Send Registration Information / Fees / Questions / Comments  to:

       Wayne Robbins
       439 B Atlantic Ave
       Ft.Story, VA 23459



   {ERR}.com v2.0 TSR successfully installed      
   Copyright XTRASoft Software 1993               
   Special Edition (* Errorlevel & Exit Codes *)  
   Author Wayne Robbins. 
   
   
   

   
        
